home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Mac Game Programming Gurus / TricksOfTheMacGameProgrammingGurus.iso / More Source / C⁄C++ / Arashi 1.1 / Game Source / mtz / mtz src / mztrap.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-01-22  |  659 b   |  41 lines  |  [TEXT/KAHL]

  1.  
  2. #include <Traps.h>
  3.  
  4. int NumToolboxTraps()
  5. {
  6.     if (NGetTrapAddress(_InitGraf, ToolTrap) == NGetTrapAddress(0xAA6E, ToolTrap)) 
  7.         return 0x200;
  8.     else
  9.         return 0x400;
  10. }
  11.  
  12. TrapType GetTrapType (theTrap)
  13. int    theTrap;
  14. {
  15.     int    TrapMask = 0x0800;
  16.  
  17.     if( BAND(theTrap, TrapMask) >0 )
  18.         return ToolTrap;
  19.     else
  20.         return OSTrap;
  21. }
  22.  
  23.  
  24.  
  25. Boolean TrapAvailable (theTrap)
  26. int theTrap;
  27. {
  28.     TrapType    tType;
  29.  
  30.     tType = GetTrapType(theTrap);
  31.     if( tType == ToolTrap)
  32.     {
  33.         theTrap = BAND(theTrap, 0x07FF);
  34.         if( theTrap >= NumToolBoxTraps())
  35.             theTrap = _Unimplemented;
  36.     }
  37.     if( NGetTrapAddress(theTrap, tType) != NGetTrapAddress(_Unimplemented, ToolTrap))
  38.         return 1;
  39.     else
  40.         return 0;
  41. }